#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions"

cmd-plugin-uninstall() {
  declare desc="uninstalls plugin via command line"
  declare cmd="plugin:uninstall"
  [[ "$1" == "$cmd" ]] && shift 1
  declare PLUGIN="$1"

  [[ -z "$PLUGIN" ]] && dokku_log_fail "Please specify a plugin to uninstall"
  uninstall_plugin "$PLUGIN"
  plugin_prime_bash_completion
}

cmd-plugin-uninstall "$@"
